Do Loops kind of Reset every time you go through it?... [closed]

Posted by JacKeown on Programmers See other posts from Programmers or by JacKeown
Published on 2011-02-27T21:22:27Z Indexed on 2011/02/27 23:32 UTC
Read the original article Hit count: 152

Filed under:
|
#include <iostream>
using namespace std;

int main (void) {
 cout << " 1\t2\t3\t4\t5\t6\t7\t8\t9" << endl << "" << endl;
 for (int c = 1; c < 10; c++) {
   cout << c << "| ";
   for (int i = 1; i < 10; i++) {
     cout << i * c << '\t';
   }
   cout << endl;
 }
 return 0;
}

Hey so this code produces a times table...I found it on Google Code's C++ class online...I'm confused about why "i" in the second for loop resets to 1 every time you go through that loop...or is it being declared again in the first parameter?

Thanks in advance!

© Programmers or respective owner

Related posts about c++

Related posts about google